package com.sunspring.jbug.support;

import com.sunspring.jbug.bean.UserInfo;

/**
 * ThreadLocal保存用户信息
 * @Author: wulei
 * @Date: 2019/3/8
 */
public class ContextHolder {

    private static ThreadLocal<UserInfo> threadLocal = new ThreadLocal<>();

    public static void add(UserInfo userInfo) {
        threadLocal.set(userInfo);
    }

    public static void remove() {
        threadLocal.remove();
    }

    public static UserInfo get() {
        return threadLocal.get();
    }
}
